package com.unina.is2.astafantaunina.chat;


import org.jivesoftware.smack.PacketListener;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.packet.Packet;

import com.unina.is2.astafantaunina.utility.GestisciPacchetto;

import android.util.Log;

public class ReceivePacket implements PacketListener {
	
	
	//Pattern singleton
	private static ReceivePacket presence = null;
	
	private ReceivePacket(){
		
	}
	
	public static ReceivePacket getListener(){
		if (presence == null){
			presence = new ReceivePacket();
		}
		return presence;
	}
	//singleton
	
	
	public void processPacket(Packet packet) {
	      Message mes = (Message)packet;
	      System.out.println("MESSAGGIO RICEVUTO "+mes.getBody());
	      Log.w("***"+mes.getBody()+"***","0");
	      new GestisciPacchetto(mes.getBody()).gestisci();
	    }

}
